package com.yihaodian.index.meta.shard;

/**
 * Information about a single shard.
 * 
 * 
 * @author zhouhang
 * 
 */
public class Shard {

	// Note: use _XXX to indicate variables that is read-only
	private double weight = 1.0;
	private int replicaNum = 3;
	private boolean enable = true;
	private ShardId shardId;

	private Shard() {

	}

	public Shard(String indexId, String sid) {
		shardId = new ShardId(indexId, sid);
	}

	public ShardId getShardId() {
		return shardId;
	}

	public double getWeight() {
		return weight;
	}

	public void setWeight(double weight) {
		this.weight = weight;
	}

	public int getReplicaNum() {
		return replicaNum;
	}

	public void setReplicaNum(int replicaNum) {
		this.replicaNum = replicaNum;
	}

	public boolean isEnable() {
		return enable;
	}

	public void setEnable(boolean enable) {
		this.enable = enable;
	}

	@Override
	public String toString() {
		return "Shard [_Id=" + shardId + ", weight=" + weight + ", replicaNum="
				+ replicaNum + "]";
	}
}
